<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>照片墙</title>
    <style>
      .photo-wall {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-around;
      }

      .photo {
        width: 200px;
        height: 200px;
        margin: 10px;
        background-size: cover;
        background-position: center;
      }
    </style>
  </head>

  <body>
    <div class="photo-wall" id="photoWall"></div>

    <script>
      // 照片数组
      const photos = [
        "https://example.com/photo1.jpg",
        "https://example.com/photo2.jpg",
        "https://example.com/photo3.jpg",
        "https://example.com/photo4.jpg",
        "https://example.com/photo5.jpg",
      ];

      // 生成照片墙
      function generatePhotoWall() {
        const photoWall = document.getElementById("photoWall");
        for (let photo of photos) {
          const div = document.createElement("div");
          div.classList.add("photo");
          div.style.backgroundImage = `url(${photo})`;
          photoWall.appendChild(div);
        }
      }

      generatePhotoWall();
    </script>
  </body>
</html>
